 // 创建用户集合
// 引入mongoose第三方模块
const mongoose = require('mongoose');
//引入string-random
const stringRandom = require("string-random");

// 创建用户集合规则
const bookListSchema = new mongoose.Schema({
    listName:{
        type: String,
        require: true
    },
    cover:{
        type: String
    },
    reBooks:{
        type: Array
    }
});

// 创建集合
const BookList = mongoose.model('BookList', bookListSchema);
const path = require('path')
async function createBookList () {
	const bookList = await BookList.create(
        {
          listName:"英语|助你轻松掌握英语",
          cover:"https://ss2.bdstatic.com/70cFvnSh_Q1YnxGkpoWK1HF6hhy/it/u=2116439799,928357877&fm=26&gp=0.jpg",
          reBooks:[
              {ISBN:"9787888660366"},
              {ISBN:"9787800809699"},
              {ISBN:"9787553634623"},
              {ISBN:"9787553755854"},
              {ISBN:"9787119086804"},
              {ISBN:"9787553625126"},
          ]
        }
    );
    console.log("数据创建成功!");
}

// createBookList();


// 将用户集合做为模块成员进行导出
module.exports = {
   BookList
}; 